# app/__init__.py
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
from config import Config
from flask_migrate import Migrate
from app.models import db
from app.models import login_manager

from flask_login import LoginManager

migrate = Migrate()


def create_app(config_class=None):
    app = Flask(__name__)
    # Markdown(app)
    app.config.from_object(Config)
    db.init_app(app)

    migrate.init_app(app, db)
    login_manager.init_app(app)
    login_manager.login_view = 'login'

    with app.app_context():
        db.create_all()

    from app.views import bp as main_bp
    app.register_blueprint(main_bp)

    return app

if __name__ == "__main__":
    app.run(debug=True)




